<?php
namespace Admin\Controller;
use Think\Controller;
class SetupController extends BaseController {
    public function index(){
		if (!IS_POST) {
        	$model = M('Setup');
        	$map['id'] = 1;
    		$info = $model->where($map)->find();
        	$this->assign('info',$info);
        	$this->display();
        }
        if (IS_POST) {
         	$model = M('Setup');
         	$data['title'] = I('post.title');
         	$data['sub_title'] = I('post.sub_title');
         	$data['keywords'] = I('post.keywords');
         	$data['description'] = I('post.description');
         	$data['url'] = I('post.url');
         	$data['mail'] = I('post.mail');
         	$data['site_statistics'] = I('post.site_statistics');
         	if($model->where('id=1')->data($data)->save()) {
                $this->success("修改成功");
            } else {
                $this->error("修改失败");
            }
        }
    }
    
}